//
//  LCHomeLendView.m
//  LendCash
//
//  Created by Mac mini on 2018/5/24.
//  Copyright © 2018年 zt. All rights reserved.
//

#import "LCHomeLendView.h"

@implementation LCHomeLendView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        UILabel *lab = [[UILabel alloc]initWithFrame:CGRectMake(10, 5, 120, 20)];
        lab.text = @"欢迎回来，你可以:";
        lab.font = [UIFont systemFontOfSize:17];
        [self addSubview:lab];
        
        UIButton *lendbutton = [self createButtonWithFrame:CGRectMake(10, frame.size.height-50, 100, 40) andTitle:@"求借款"];
        [lendbutton setTag:home_lend_click];
        [self addSubview:lendbutton];
        
          UIButton *writebutton = [self createButtonWithFrame:CGRectMake(frame.size.width-110, frame.size.height-50, 100, 40) andTitle:@"补借条"];
        [writebutton setTag:home_write_click];
        [self addSubview:writebutton];
    }
    return self;
}

-(UIButton *)createButtonWithFrame:(CGRect)frame andTitle:(NSString *)title{
     UIButton *button = [[UIButton alloc]initWithFrame:frame];
    [button setBackgroundColor:PUBLIC_MAIN_BTN_COLOR];
    [button setTitle:title forState:UIControlStateNormal];
    button.layer.cornerRadius = 5;
    [button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    return button;
}

-(void)click:(UIButton *)sender{
    if (self.lendViewCallBack) {
        self.lendViewCallBack(sender.tag);
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
